$(function () {
    var url='../invite/list'
    $("#jqGrid").Grid({
        url: url,
        datatype: "json",
        height: '400',
        mtype:'POST',
        colModel: [
            // {label: '分享人姓名', name: 'id', index: 'id'},
            {label: '分享人姓名', name: 'parentName', index: 'parentName',formatter:function(cellvalue, options, rowObj){
                    return "<span id='"+rowObj.parentId+"' class='mark_data'>"+cellvalue+"</span>";
            }},
            {label: '分享人手机号', name: 'parentMobile', index: 'parentMobile'},
            {label: '被分享人姓名', name: 'nickName', index: 'nickName'},
            {label: '被分享人手机号', name: 'mobile', index: 'mobile'},
            {label: '分享商品', name: 'goodName', index: 'goodName'},
            {label: '分享时间', name: 'createTime', index: 'createTime'},
        ]
    });
    $('#jqGrid').on('click','.mark_data',function(){
        var id = $(this).attr('id')
        console.log(id)
        if (id == null) {
            return;
        }
        openWindow({
            title: '分享人订单记录',
            type: 2,
            content: '../shop/inviteOrder.html?id=' + id
        })
    })
});

let vm = new Vue({
    el: '#rrapp',
    data: {
        q: {
            param:''

        },
        listDataShow:true
    },
    methods: {

        listExport() {

            exportFile('#rrapp', '../invite/export',{parentId:''});
        },
        query(){
            vm.reload()
            // this.listDataShow=false
        },
        reload(){
            var page = $("#jqGrid").jqGrid('getGridParam', 'page');
            console.log(page);
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {
                    'parentName': vm.q.param
                },
                page: page
            }).trigger("reloadGrid");
        }
    },
    created: function () {

    }
});